home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / pause3.arc / PAUSE3.ASM next >
Assembly Source File  |  1987-03-05  |  4KB  |  114 lines

  1.         TITLE    PAUSE III
  2.  
  3. CODESEG        SEGMENT PARA PUBLIC 'CODE'
  4.         ASSUME    CS:CODESEG,DS:CODESEG
  5.  
  6. ;_____________________________________________________________________________
  7. ;
  8. ;                PAUSE3.COM
  9. ;
  10. ;        A subcommand (to be used in batch files,
  11. ;        especially when ECHO is off)
  12. ;
  13. ;
  14. ;    This program is an improved version of DOS's PAUSE command. The
  15. ;    problems with DOS's PAUSE command are that, when ECHO is off,
  16. ;    it only displays one message ("Strike a key when ready . . ."),
  17. ;    and it doesn't alert the user when it appears. This program allows
  18. ;    users to display any message they want, which could include beeps.
  19. ;
  20. ;-----------------------------------------------------------------------------
  21. ;
  22. ;
  23. ;    Purpose:   Suspends system processing, displays a message, and
  24. ;           waits for the user to press a character key.
  25. ;
  26. ;    Format:    PAUSE3 [remark]
  27. ;
  28. ;     Type:       Internal    External
  29. ;                 ***
  30. ;
  31. ;    Remarks:   The remark in the PAUSE3 command is optional; it may
  32. ;                  be left out.  If it is left out, the remark will be a
  33. ;                  standard "Press a key when ready .  .  ."  Unlike DOS's
  34. ;                  PAUSE command, PAUSE3 uses the remark as the message that it
  35. ;                  will display Beeps can be put in the remark by holding down
  36. ;                  <Ctrl> and pressing the 'G' key.  On screen, you should see
  37. ;                  ^G.  When the message is redisplayed, a beep will replace
  38. ;                  ^G.  NOTE:  You cannot use the characters '>','|', and '<'
  39. ;                  in a remark.  This is because they are DOS redirection
  40. ;                  symbols.
  41. ;
  42. ;    Examples:  Here is an example of DOS's PAUSE command:
  43. ;
  44. ;                A>PAUSE This is DOS's PAUSE.
  45. ;            Strike a key when ready . . .
  46. ;
  47. ;           Here is the same example, but in a batch file which
  48. ;           has had a previous ECHO OFF instruction:
  49. ;
  50. ;            Strike a key when ready . . .
  51. ;
  52. ;           Here is an example of PAUSE3:
  53. ;
  54. ;            A>PAUSE3 This is PAUSE3. Press a key ==}
  55. ;            This is PAUSE3. Press a key ==}
  56. ;
  57. ;           Here is the same example, but in a batch file which
  58. ;           has had a previous ECHO OFF instruction:
  59. ;
  60. ;                       This is PAUSE3. Press a key ==}
  61. ;
  62. ;               Here is a PAUSE3 example with beeping in it:
  63. ;
  64. ;            A>PAUSE3 You're all done! Press a key --^G^G^G
  65. ;            You're all done! Press a key -- [beep beep beep]
  66. ;
  67. ;
  68. ;    SEND ALL QUESTIONS AND COMMENTS TO:
  69. ;    Scott Pakin
  70. ;    6007 N. Sheridan Rd.
  71. ;    Chicago, IL    60660
  72. ;_____________________________________________________________________________
  73.  
  74.  
  75.         ORG    100H        ;MAKE THIS A .COM FILE
  76.  
  77. START        PROC     FAR        ;PROCEDURE STARTS HERE
  78.                 CLD            ;DIRECTION = FORWARDS
  79.         MOV    SI,80H        ;GET NUMBER OF BYTES IN MESSAGE
  80.                 MOV    CL,[SI]        ;FROM COMMAND LINE
  81.                 CMP    CL,2        ;AT LEAST 2 BYTES LONG?
  82.                 JAE    DISPMSG        ;YES -- DISPLAY MESSAGE
  83.  
  84.         LEA    DX,PRESSKEY    ;SAY "PRESS A KEY WHEN READY"
  85.                 MOV    AH,9
  86.                 INT    21H
  87.                 JMP    GETKEY        ;WAIT FOR KEYPRESS
  88.  
  89. DISPMSG:    INC    SI        ;START AT FIRST BYTE OF MESSAGE
  90.         INC    SI
  91.         XOR    CH,CH        ;MAKE CL A 16-BIT NUMBER
  92.                 DEC    CX        ;DON'T OUTPUT CARRIAGE RETURN
  93. DONEXT:         LODSB            ;GET A CHARACTER
  94.                 MOV    DL,AL        ;OUTPUT CHARACTER
  95.                 MOV    AH,2
  96.                 INT    21H
  97.                 LOOP    DONEXT        ;GET NEXT CHARACTER
  98.  
  99. GETKEY:        MOV    AH,0CH        ;CLEAR KEYBOARD BUFFER
  100.         MOV    AL,1        ;AND WAIT FOR A KEY TO BE PRESSED
  101.                 INT    21H        ;(WITH CTRL-BREAK CHECK)
  102.  
  103.         MOV    AH,2        ;DISPLAY A
  104.         MOV    DL,13        ;CARRIAGE RETURN
  105.                 INT    21H        ;AND
  106.                 MOV    DL,10        ;A LINEFEED
  107.                 INT    21H        ;
  108.         INT    20H        ;RETURN TO DOS
  109.  
  110. PRESSKEY    DB    'Press a key when ready . . . $'
  111. START        ENDP
  112. CODESEG        ENDS
  113.         END    START
  114.